let person = {
    name: "baichen",
    age: 18,
    money: 0,
    magic: [1, 2, 3, 4, 5, 6],
    do_magic: function(){
        return this.magic;
    },
    thing: {
        blood: 2,
        magic: 1
    }
}


function cmp(a, b) {
    return b - a;
}

let cmp2 = function(a, b){
    return b - a;
};

let cmp3 = (a, b)=>{
    return b - a;
}
// 数组
// for (let i of person["magic"]) console.log(`${i}\n`);

// 对象
// for (let i in person) console.log(`${i}: ${person[i]}\n`);

let a = [1, "abc", function(){return 0}];
console.log(a, a.length);

let b = [2, 1, 4, 5, 3, 6];
b.push(0);
b.pop();
b.splice(0, 2);
console.log(b.sort(cmp3));